/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('acm', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model BatchExportConfigurationsRequest {
  data?: string(name='Data', description='This parameter is required.'),
  namespaceId?: string(name='NamespaceId', description='This parameter is required.'),
}

model BatchExportConfigurationsResponseBody = {
  code?: string(name='Code'),
  fileUrl?: string(name='FileUrl'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model BatchExportConfigurationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BatchExportConfigurationsResponseBody(name='body'),
}

/**
 * @param request BatchExportConfigurationsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return BatchExportConfigurationsResponse
 */
async function batchExportConfigurationsWithOptions(request: BatchExportConfigurationsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): BatchExportConfigurationsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.data)) {
    query['Data'] = request.data;
  }
  if (!Util.isUnset(request.namespaceId)) {
    query['NamespaceId'] = request.namespaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'BatchExportConfigurations',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/batch/export`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request BatchExportConfigurationsRequest
 * @return BatchExportConfigurationsResponse
 */
async function batchExportConfigurations(request: BatchExportConfigurationsRequest): BatchExportConfigurationsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return batchExportConfigurationsWithOptions(request, headers, runtime);
}

model BatchImportConfigurationsRequest {
  fileUrl?: string(name='FileUrl', description='This parameter is required.'),
  namespaceId?: string(name='NamespaceId', description='This parameter is required.'),
  policy?: string(name='Policy', description='This parameter is required.'),
}

model BatchImportConfigurationsResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model BatchImportConfigurationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BatchImportConfigurationsResponseBody(name='body'),
}

/**
 * @param request BatchImportConfigurationsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return BatchImportConfigurationsResponse
 */
async function batchImportConfigurationsWithOptions(request: BatchImportConfigurationsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): BatchImportConfigurationsResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.fileUrl)) {
    body['FileUrl'] = request.fileUrl;
  }
  if (!Util.isUnset(request.namespaceId)) {
    body['NamespaceId'] = request.namespaceId;
  }
  if (!Util.isUnset(request.policy)) {
    body['Policy'] = request.policy;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'BatchImportConfigurations',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/batch/import`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request BatchImportConfigurationsRequest
 * @return BatchImportConfigurationsResponse
 */
async function batchImportConfigurations(request: BatchImportConfigurationsRequest): BatchImportConfigurationsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return batchImportConfigurationsWithOptions(request, headers, runtime);
}

model CheckConfigurationCloneRequest {
  data?: string(name='Data', description='This parameter is required.'),
  namespaceFrom?: string(name='NamespaceFrom', description='This parameter is required.'),
  namespaceTo?: string(name='NamespaceTo', description='This parameter is required.'),
  policy?: string(name='Policy', description='This parameter is required.'),
}

model CheckConfigurationCloneResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    success?: boolean(name='Success'),
    successItems?: [ 
      {
        dataId?: string(name='DataId'),
        group?: string(name='Group'),
      }
    ](name='SuccessItems'),
    totalCount?: int32(name='TotalCount'),
  }(name='Result'),
}

model CheckConfigurationCloneResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckConfigurationCloneResponseBody(name='body'),
}

/**
 * @param request CheckConfigurationCloneRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckConfigurationCloneResponse
 */
async function checkConfigurationCloneWithOptions(request: CheckConfigurationCloneRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CheckConfigurationCloneResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.data)) {
    body['Data'] = request.data;
  }
  if (!Util.isUnset(request.namespaceFrom)) {
    body['NamespaceFrom'] = request.namespaceFrom;
  }
  if (!Util.isUnset(request.namespaceTo)) {
    body['NamespaceTo'] = request.namespaceTo;
  }
  if (!Util.isUnset(request.policy)) {
    body['Policy'] = request.policy;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CheckConfigurationClone',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/batch/checkForClone`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CheckConfigurationCloneRequest
 * @return CheckConfigurationCloneResponse
 */
async function checkConfigurationClone(request: CheckConfigurationCloneRequest): CheckConfigurationCloneResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return checkConfigurationCloneWithOptions(request, headers, runtime);
}

model CheckConfigurationExportRequest {
  data?: string(name='Data', description='This parameter is required.'),
  namespaceId?: string(name='NamespaceId', description='This parameter is required.'),
}

model CheckConfigurationExportResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    totalCount?: int32(name='TotalCount'),
  }(name='Result'),
}

model CheckConfigurationExportResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckConfigurationExportResponseBody(name='body'),
}

/**
 * @param request CheckConfigurationExportRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckConfigurationExportResponse
 */
async function checkConfigurationExportWithOptions(request: CheckConfigurationExportRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CheckConfigurationExportResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.data)) {
    body['Data'] = request.data;
  }
  if (!Util.isUnset(request.namespaceId)) {
    body['NamespaceId'] = request.namespaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CheckConfigurationExport',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/batch/checkForExport`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CheckConfigurationExportRequest
 * @return CheckConfigurationExportResponse
 */
async function checkConfigurationExport(request: CheckConfigurationExportRequest): CheckConfigurationExportResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return checkConfigurationExportWithOptions(request, headers, runtime);
}

model CloneConfigurationRequest {
  data?: string(name='Data', description='This parameter is required.'),
  namespaceFrom?: string(name='NamespaceFrom', description='This parameter is required.'),
  namespaceTo?: string(name='NamespaceTo', description='This parameter is required.'),
  policy?: string(name='Policy', description='This parameter is required.'),
}

model CloneConfigurationResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  result?: {
    success?: boolean(name='Success'),
    successItems?: [ 
      {
        dataId?: string(name='DataId'),
        group?: string(name='Group'),
      }
    ](name='SuccessItems'),
    totalCount?: int32(name='TotalCount'),
  }(name='Result'),
}

model CloneConfigurationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CloneConfigurationResponseBody(name='body'),
}

/**
 * @param request CloneConfigurationRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CloneConfigurationResponse
 */
async function cloneConfigurationWithOptions(request: CloneConfigurationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CloneConfigurationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.data)) {
    body['Data'] = request.data;
  }
  if (!Util.isUnset(request.namespaceFrom)) {
    body['NamespaceFrom'] = request.namespaceFrom;
  }
  if (!Util.isUnset(request.namespaceTo)) {
    body['NamespaceTo'] = request.namespaceTo;
  }
  if (!Util.isUnset(request.policy)) {
    body['Policy'] = request.policy;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CloneConfiguration',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/batch/clone`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CloneConfigurationRequest
 * @return CloneConfigurationResponse
 */
async function cloneConfiguration(request: CloneConfigurationRequest): CloneConfigurationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return cloneConfigurationWithOptions(request, headers, runtime);
}

model CreateConfigurationRequest {
  appName?: string(name='AppName', example='app'),
  content?: string(name='Content', description='This parameter is required.', example='key=Hello;value=World'),
  dataId?: string(name='DataId', description='This parameter is required.', example='com.aliyun.acm.example'),
  desc?: string(name='Desc'),
  group?: string(name='Group', description='This parameter is required.', example='DEFAULT_GROUP'),
  namespaceId?: string(name='NamespaceId', description='This parameter is required.', example='01146121-decf-4b47-****'),
  tags?: string(name='Tags', example='tag1,tag2'),
  type?: string(name='Type', description='This parameter is required.', example='text'),
}

model CreateConfigurationResponseBody = {
  code?: string(name='Code', example='OK'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', example='132BF104-A660-40C7-936B-F805967*****'),
}

model CreateConfigurationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateConfigurationResponseBody(name='body'),
}

/**
 * @param request CreateConfigurationRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateConfigurationResponse
 */
async function createConfigurationWithOptions(request: CreateConfigurationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateConfigurationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appName)) {
    body['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  if (!Util.isUnset(request.dataId)) {
    body['DataId'] = request.dataId;
  }
  if (!Util.isUnset(request.desc)) {
    body['Desc'] = request.desc;
  }
  if (!Util.isUnset(request.group)) {
    body['Group'] = request.group;
  }
  if (!Util.isUnset(request.namespaceId)) {
    body['NamespaceId'] = request.namespaceId;
  }
  if (!Util.isUnset(request.tags)) {
    body['Tags'] = request.tags;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateConfiguration',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/configuration`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateConfigurationRequest
 * @return CreateConfigurationResponse
 */
async function createConfiguration(request: CreateConfigurationRequest): CreateConfigurationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createConfigurationWithOptions(request, headers, runtime);
}

model CreateNamespaceRequest {
  name?: string(name='Name', description='This parameter is required.'),
}

model CreateNamespaceResponseBody = {
  code?: string(name='Code', example='OK'),
  message?: string(name='Message', example='Success'),
  namespaceId?: string(name='NamespaceId', example='3115d2bf-1f44-47bf-a855-****'),
  requestId?: string(name='RequestId', example='6F7CC94A-7711-4873-8848-****'),
}

model CreateNamespaceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateNamespaceResponseBody(name='body'),
}

/**
 * @param request CreateNamespaceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateNamespaceResponse
 */
async function createNamespaceWithOptions(request: CreateNamespaceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateNamespaceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateNamespace',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/namespace`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateNamespaceRequest
 * @return CreateNamespaceResponse
 */
async function createNamespace(request: CreateNamespaceRequest): CreateNamespaceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createNamespaceWithOptions(request, headers, runtime);
}

model DeleteConfigurationRequest {
  dataId?: string(name='DataId', description='This parameter is required.', example='com.aliyun.acm.example'),
  group?: string(name='Group', description='This parameter is required.', example='DEFAULT_GROUP'),
  namespaceId?: string(name='NamespaceId', description='This parameter is required.', example='10d1110d2-ca66-42ba-b706-****'),
}

model DeleteConfigurationResponseBody = {
  code?: string(name='Code', example='OK'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', example='617CC94A-0019-4873-8848-****'),
}

model DeleteConfigurationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteConfigurationResponseBody(name='body'),
}

/**
 * @param request DeleteConfigurationRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteConfigurationResponse
 */
async function deleteConfigurationWithOptions(request: DeleteConfigurationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteConfigurationResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.dataId)) {
    query['DataId'] = request.dataId;
  }
  if (!Util.isUnset(request.group)) {
    query['Group'] = request.group;
  }
  if (!Util.isUnset(request.namespaceId)) {
    query['NamespaceId'] = request.namespaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteConfiguration',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/configuration`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeleteConfigurationRequest
 * @return DeleteConfigurationResponse
 */
async function deleteConfiguration(request: DeleteConfigurationRequest): DeleteConfigurationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteConfigurationWithOptions(request, headers, runtime);
}

model DeleteNamespaceRequest {
  namespaceId?: string(name='NamespaceId', description='This parameter is required.', example='112300d2-ca66-42ba-b706-****'),
}

model DeleteNamespaceResponseBody = {
  code?: string(name='Code', example='OK'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', example='611CC94A-7711-4873-8848-****'),
}

model DeleteNamespaceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteNamespaceResponseBody(name='body'),
}

/**
 * @param request DeleteNamespaceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteNamespaceResponse
 */
async function deleteNamespaceWithOptions(request: DeleteNamespaceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteNamespaceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.namespaceId)) {
    query['NamespaceId'] = request.namespaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteNamespace',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/namespace`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeleteNamespaceRequest
 * @return DeleteNamespaceResponse
 */
async function deleteNamespace(request: DeleteNamespaceRequest): DeleteNamespaceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteNamespaceWithOptions(request, headers, runtime);
}

model DeployConfigurationRequest {
  appName?: string(name='AppName', example='app'),
  betaIps?: string(name='BetaIps', example='127.0.0.1'),
  content?: string(name='Content', description='This parameter is required.', example='Hello World'),
  dataId?: string(name='DataId', description='This parameter is required.', example='com.aliyun.acm.example'),
  desc?: string(name='Desc'),
  group?: string(name='Group', description='This parameter is required.', example='DEFAULT_GROUP'),
  namespaceId?: string(name='NamespaceId', description='This parameter is required.', example='111000d2-ca66-42ba-b706-****'),
  tags?: string(name='Tags', example='tag1,tag2'),
  type?: string(name='Type', example='text'),
}

model DeployConfigurationResponseBody = {
  code?: string(name='Code', example='OK'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', example='611CC94A-7711-4873-8848-****'),
}

model DeployConfigurationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeployConfigurationResponseBody(name='body'),
}

/**
 * @param request DeployConfigurationRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeployConfigurationResponse
 */
async function deployConfigurationWithOptions(request: DeployConfigurationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeployConfigurationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appName)) {
    body['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.betaIps)) {
    body['BetaIps'] = request.betaIps;
  }
  if (!Util.isUnset(request.content)) {
    body['Content'] = request.content;
  }
  if (!Util.isUnset(request.dataId)) {
    body['DataId'] = request.dataId;
  }
  if (!Util.isUnset(request.desc)) {
    body['Desc'] = request.desc;
  }
  if (!Util.isUnset(request.group)) {
    body['Group'] = request.group;
  }
  if (!Util.isUnset(request.namespaceId)) {
    body['NamespaceId'] = request.namespaceId;
  }
  if (!Util.isUnset(request.tags)) {
    body['Tags'] = request.tags;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeployConfiguration',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/configuration`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DeployConfigurationRequest
 * @return DeployConfigurationResponse
 */
async function deployConfiguration(request: DeployConfigurationRequest): DeployConfigurationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deployConfigurationWithOptions(request, headers, runtime);
}

model DescribeConfigurationRequest {
  dataId?: string(name='DataId', description='This parameter is required.', example='com.aliyun.acm.example'),
  group?: string(name='Group', description='This parameter is required.', example='DEFAULT_GROUP'),
  namespaceId?: string(name='NamespaceId', description='This parameter is required.', example='101100d2-ca66-42ba-b706-****'),
}

model DescribeConfigurationResponseBody = {
  code?: string(name='Code', example='OK'),
  configuration?: {
    appName?: string(name='AppName', example='app'),
    content?: string(name='Content', example='Hello World'),
    dataId?: string(name='DataId', example='com.aliyun.acm.example'),
    desc?: string(name='Desc'),
    gmtCreate?: string(name='GmtCreate', nullable=true),
    gmtModified?: string(name='GmtModified', nullable=true),
    group?: string(name='Group', example='DEFAULT_GROUP'),
    md5?: string(name='Md5', example='18d2e20****'),
    tags?: string(name='Tags', example='tag1,tag2'),
    type?: string(name='Type', example='text'),
  }(name='Configuration'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', example='611CC94A-7711-4873-8848-****'),
}

model DescribeConfigurationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeConfigurationResponseBody(name='body'),
}

/**
 * @param request DescribeConfigurationRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeConfigurationResponse
 */
async function describeConfigurationWithOptions(request: DescribeConfigurationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeConfigurationResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.dataId)) {
    query['DataId'] = request.dataId;
  }
  if (!Util.isUnset(request.group)) {
    query['Group'] = request.group;
  }
  if (!Util.isUnset(request.namespaceId)) {
    query['NamespaceId'] = request.namespaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeConfiguration',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/configuration`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeConfigurationRequest
 * @return DescribeConfigurationResponse
 */
async function describeConfiguration(request: DescribeConfigurationRequest): DescribeConfigurationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeConfigurationWithOptions(request, headers, runtime);
}

model DescribeImportFileUrlRequest {
  contentType?: string(name='ContentType', description='This parameter is required.'),
}

model DescribeImportFileUrlResponseBody = {
  code?: string(name='Code'),
  fileUrl?: string(name='FileUrl'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model DescribeImportFileUrlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeImportFileUrlResponseBody(name='body'),
}

/**
 * @param request DescribeImportFileUrlRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeImportFileUrlResponse
 */
async function describeImportFileUrlWithOptions(request: DescribeImportFileUrlRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeImportFileUrlResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.contentType)) {
    query['ContentType'] = request.contentType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeImportFileUrl',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/batch/importFileUrl`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeImportFileUrlRequest
 * @return DescribeImportFileUrlResponse
 */
async function describeImportFileUrl(request: DescribeImportFileUrlRequest): DescribeImportFileUrlResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeImportFileUrlWithOptions(request, headers, runtime);
}

model DescribeNamespaceRequest {
  namespaceId?: string(name='NamespaceId', description='This parameter is required.', example='3115d2bf-1f44-47bf-a855-****'),
}

model DescribeNamespaceResponseBody = {
  code?: string(name='Code', example='OK'),
  message?: string(name='Message', example='Success'),
  namespace?: {
    accessKey?: string(name='AccessKey', example='2c017****'),
    endpoint?: string(name='Endpoint', example='acm.aliyun.com'),
    name?: string(name='Name'),
    regionId?: string(name='RegionId', example='cn-shanghai'),
    secretKey?: string(name='SecretKey', example='6/eQ0****'),
  }(name='Namespace'),
  requestId?: string(name='RequestId', example='3116581E-C664-4D3A-A055-****'),
}

model DescribeNamespaceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeNamespaceResponseBody(name='body'),
}

/**
 * @param request DescribeNamespaceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeNamespaceResponse
 */
async function describeNamespaceWithOptions(request: DescribeNamespaceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeNamespaceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.namespaceId)) {
    query['NamespaceId'] = request.namespaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeNamespace',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/namespace`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeNamespaceRequest
 * @return DescribeNamespaceResponse
 */
async function describeNamespace(request: DescribeNamespaceRequest): DescribeNamespaceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeNamespaceWithOptions(request, headers, runtime);
}

model DescribeNamespacesResponseBody = {
  code?: string(name='Code', example='OK'),
  message?: string(name='Message', example='Success'),
  namespaces?: [ 
    {
      configCount?: int32(name='ConfigCount', example='20'),
      namespaceId?: string(name='NamespaceId', example='3115d2bf-1f44-47bf-a855-****'),
      namespaceName?: string(name='NamespaceName'),
      quota?: int32(name='Quota', example='200'),
      type?: int32(name='Type', example='1'),
    }
  ](name='Namespaces'),
  requestId?: string(name='RequestId', example='3116581E-C664-4D3A-A055-****'),
}

model DescribeNamespacesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeNamespacesResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeNamespacesResponse
 */
async function describeNamespacesWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): DescribeNamespacesResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeNamespaces',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/namespace/list`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return DescribeNamespacesResponse
 */
async function describeNamespaces(): DescribeNamespacesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeNamespacesWithOptions(headers, runtime);
}

model DescribeNamespacesWithCreateResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  namespaces?: [ 
    {
      configCount?: int32(name='ConfigCount'),
      namespaceId?: string(name='NamespaceId'),
      namespaceName?: string(name='NamespaceName'),
      quota?: int32(name='Quota'),
      type?: int32(name='Type'),
    }
  ](name='Namespaces'),
  requestId?: string(name='RequestId'),
}

model DescribeNamespacesWithCreateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeNamespacesWithCreateResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeNamespacesWithCreateResponse
 */
async function describeNamespacesWithCreateWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): DescribeNamespacesWithCreateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeNamespacesWithCreate',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/namespace/listWithCreate`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return DescribeNamespacesWithCreateResponse
 */
async function describeNamespacesWithCreate(): DescribeNamespacesWithCreateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeNamespacesWithCreateWithOptions(headers, runtime);
}

model DescribeTraceByConfigurationRequest {
  dataId?: string(name='DataId', description='This parameter is required.'),
  endTs?: string(name='EndTs'),
  group?: string(name='Group', description='This parameter is required.'),
  namespaceId?: string(name='NamespaceId', description='This parameter is required.'),
  startTs?: string(name='StartTs'),
}

model DescribeTraceByConfigurationResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  traces?: [ 
    {
      eventGroups?: [ 
        {
          eventDetails?: [ 
            {
              dataId?: string(name='DataId'),
              delay?: string(name='Delay'),
              event?: string(name='Event'),
              ext?: string(name='Ext'),
              group?: string(name='Group'),
              handleIp?: string(name='HandleIp'),
              logDate?: string(name='LogDate'),
              requestIp?: string(name='RequestIp'),
              responseIp?: string(name='ResponseIp'),
              ts?: string(name='Ts'),
              type?: string(name='Type'),
            }
          ](name='EventDetails'),
          eventType?: string(name='EventType'),
        }
      ](name='EventGroups'),
      timestamp?: long(name='Timestamp'),
    }
  ](name='Traces'),
}

model DescribeTraceByConfigurationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeTraceByConfigurationResponseBody(name='body'),
}

/**
 * @param request DescribeTraceByConfigurationRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeTraceByConfigurationResponse
 */
async function describeTraceByConfigurationWithOptions(request: DescribeTraceByConfigurationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeTraceByConfigurationResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.dataId)) {
    query['DataId'] = request.dataId;
  }
  if (!Util.isUnset(request.endTs)) {
    query['EndTs'] = request.endTs;
  }
  if (!Util.isUnset(request.group)) {
    query['Group'] = request.group;
  }
  if (!Util.isUnset(request.namespaceId)) {
    query['NamespaceId'] = request.namespaceId;
  }
  if (!Util.isUnset(request.startTs)) {
    query['StartTs'] = request.startTs;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeTraceByConfiguration',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/trace/getByConfiguration`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeTraceByConfigurationRequest
 * @return DescribeTraceByConfigurationResponse
 */
async function describeTraceByConfiguration(request: DescribeTraceByConfigurationRequest): DescribeTraceByConfigurationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeTraceByConfigurationWithOptions(request, headers, runtime);
}

model UpdateNamespaceRequest {
  namespaceId?: string(name='NamespaceId', description='This parameter is required.', example='710b2fbe-0da3-4388-****'),
  namespaceName?: string(name='NamespaceName', description='This parameter is required.'),
}

model UpdateNamespaceResponseBody = {
  code?: string(name='Code', example='OK'),
  message?: string(name='Message', example='Success'),
  requestId?: string(name='RequestId', example='51193061-ED0D-4EC6-B160-****'),
}

model UpdateNamespaceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateNamespaceResponseBody(name='body'),
}

/**
 * @param request UpdateNamespaceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateNamespaceResponse
 */
async function updateNamespaceWithOptions(request: UpdateNamespaceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateNamespaceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.namespaceId)) {
    body['NamespaceId'] = request.namespaceId;
  }
  if (!Util.isUnset(request.namespaceName)) {
    body['NamespaceName'] = request.namespaceName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateNamespace',
    version = '2020-02-06',
    protocol = 'HTTPS',
    pathname = `/diamond-ops/pop/namespace`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request UpdateNamespaceRequest
 * @return UpdateNamespaceResponse
 */
async function updateNamespace(request: UpdateNamespaceRequest): UpdateNamespaceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateNamespaceWithOptions(request, headers, runtime);
}

